How to get layout DXL history for Object Number changes(moves)

I have DXL to display redline history for Object Text. It works for attributes that have before and after textual changes but i need to display history for object number and object moves. Tinkered with it without much luck...any ideas?

I changed these lines to moveObject and Object Number and wasnt giving me any result

 

if (ht == modifyObject)

displayRichWithColour getHistoryForAttributes(obj, "Object Text", defaultDescribeEvent) 

 

Date afterDate = "09/25/2018"//used this hardcoded date rather than the date number.

 

void defaultDescribeEvent(Object o, string sAttribute, History h, Buffer b)
{
                Buffer v = create()
                Buffer old = create(); old = h.plainOldValue;
                Buffer new = create(); new = h.plainNewValue;

                diff (v, old,new, "\\cf1\\strike ", "\\cf3\\ul ")

 

                b += "{\\b On }"
                Date d = h.date
                b += d ""
                b += " {\\b "
                b += h.author ""
                b += "} "
                // object modification has old and new values
                b += " modified {\\b "
                b += h.attrName "} "
                b += " \\par "
                b += v
                b += " \\par "

                delete old
                delete new
                delete v
}
string getHistoryForAttributes(Object o, string sAtt, void describeEvent(Object, string, History, Buffer))
{
                History h = null
                HistoryType ht = null
                Buffer b = create()
                for h in o do
                {
                                if(h.readlocked)
                                                continue
                                Date x = h.date

                                if (x < afterDate) continue
                                ht = h.type
                                if (ht == modifyObject)
                                {
                                               string sAttribute = h.attrName
                                               if (sAtt == sAttribute)
                                               describeEvent(o, sAttribute, h, b)
                                }
                }
                string sHistory = stringOf(b)
                delete b
                return sHistory
}
displayRichWithColour getHistoryForAttributes(obj, "Object Text", defaultDescribeEvent)


bmohamed - Thu Sep 27 14:00:34 EDT 2018

Re: How to get layout DXL history for Object Number changes(moves)
PekkaMakinen - Fri Sep 28 02:26:12 EDT 2018

If you look at DXL Reference section "History" it shows that there are history constants clipCutObject and clipMoveObject and then there are history poroperties position and newPosition. Using these we can modify the example program in the "History" section as follows:

 

// history DXL Example 
/*
  Example history DXL program.
  Generate a report of the current Module's
  history.
*/ 
// print a brief report of the history record 
void print(History h) {
    HistoryType ht = h.type 
    print h.author "\t" h.date "\t" ht "\t" 
    if (ht == createType ||
        ht == modifyType ||
        ht == deleteType)  { // attribute type
        print h.typeName
    } else if (ht == createAttr ||
               ht == modifyAttr ||
               ht == deleteAttr)  {  
      // attribute definition
      print h.attrName 
    } else if (ht == createObject ||
               ht == clipCopyObject  ||
               ht == modifyObject) { // object
        print h.absNo 
        if (ht==modifyObject) { 
        // means an attribute has changed 
            string oldV = h.oldValue 
            string newV = h.newValue 
           print " (" h.attrName ":" oldV " -> "
                 newV ")"
        }
        }
      else if ((ht == clipCutObject) || (ht == clipMoveObject))
          {
             print "Moved " h.position "->" h.newPosition ""
          }
    print "\n"
} 
// Main program 
History h 
print "All history\n\n" 
for h in current Module do print h 
print "\nHistory for current Object\n\n" 
for h in current Object do print h 
print "\nNon object history\n\n" 
for h in top current Module do print h 

Re: How to get layout DXL history for Object Number changes(moves)
O.Wilkop - Fri Sep 28 02:40:33 EDT 2018

PekkaMakinen - Fri Sep 28 02:26:12 EDT 2018

If you look at DXL Reference section "History" it shows that there are history constants clipCutObject and clipMoveObject and then there are history poroperties position and newPosition. Using these we can modify the example program in the "History" section as follows:

 

// history DXL Example 
/*
  Example history DXL program.
  Generate a report of the current Module's
  history.
*/ 
// print a brief report of the history record 
void print(History h) {
    HistoryType ht = h.type 
    print h.author "\t" h.date "\t" ht "\t" 
    if (ht == createType ||
        ht == modifyType ||
        ht == deleteType)  { // attribute type
        print h.typeName
    } else if (ht == createAttr ||
               ht == modifyAttr ||
               ht == deleteAttr)  {  
      // attribute definition
      print h.attrName 
    } else if (ht == createObject ||
               ht == clipCopyObject  ||
               ht == modifyObject) { // object
        print h.absNo 
        if (ht==modifyObject) { 
        // means an attribute has changed 
            string oldV = h.oldValue 
            string newV = h.newValue 
           print " (" h.attrName ":" oldV " -> "
                 newV ")"
        }
        }
      else if ((ht == clipCutObject) || (ht == clipMoveObject))
          {
             print "Moved " h.position "->" h.newPosition ""
          }
    print "\n"
} 
// Main program 
History h 
print "All history\n\n" 
for h in current Module do print h 
print "\nHistory for current Object\n\n" 
for h in current Object do print h 
print "\nNon object history\n\n" 
for h in top current Module do print h 

To add to that: the historyType "moveObject" also exists (but is not documented) and is used to display object changes done by (for example) the move(object, object) function. The position and newPosition properties are the same here.

Re: How to get layout DXL history for Object Number changes(moves)
bmohamed - Tue Oct 02 15:12:03 EDT 2018

PekkaMakinen - Fri Sep 28 02:26:12 EDT 2018

If you look at DXL Reference section "History" it shows that there are history constants clipCutObject and clipMoveObject and then there are history poroperties position and newPosition. Using these we can modify the example program in the "History" section as follows:

 

// history DXL Example 
/*
  Example history DXL program.
  Generate a report of the current Module's
  history.
*/ 
// print a brief report of the history record 
void print(History h) {
    HistoryType ht = h.type 
    print h.author "\t" h.date "\t" ht "\t" 
    if (ht == createType ||
        ht == modifyType ||
        ht == deleteType)  { // attribute type
        print h.typeName
    } else if (ht == createAttr ||
               ht == modifyAttr ||
               ht == deleteAttr)  {  
      // attribute definition
      print h.attrName 
    } else if (ht == createObject ||
               ht == clipCopyObject  ||
               ht == modifyObject) { // object
        print h.absNo 
        if (ht==modifyObject) { 
        // means an attribute has changed 
            string oldV = h.oldValue 
            string newV = h.newValue 
           print " (" h.attrName ":" oldV " -> "
                 newV ")"
        }
        }
      else if ((ht == clipCutObject) || (ht == clipMoveObject))
          {
             print "Moved " h.position "->" h.newPosition ""
          }
    print "\n"
} 
// Main program 
History h 
print "All history\n\n" 
for h in current Module do print h 
print "\nHistory for current Object\n\n" 
for h in current Object do print h 
print "\nNon object history\n\n" 
for h in top current Module do print h 

I modified the above to show a report of the moves(mostly) via Edit DXL window. I wasnt able to use as layout dxl and hadnt had time to see if i can figure that out. it got me close to where i need to be ...thanks!